import React from "react";

const Register = () => {
    //表单提交
    const onFinish = (values: any) => {
        React.UI.Dialog.confirm({
            content: '是否注册',
            onConfirm: async () => {
                // 发送请求
                let result = await React.HTTP.post("/Business/register", values)
                if (result.code == 1) {
                    React.success(result.msg,()=>{
                        React.navigate("/business/login")
                    })
                    // 页面
                } else {
                    React.error(result.msg)
                }
            },
        })

    }
    return (
        <>
            <link rel="stylesheet" href="/assets/css/login.css" />
            <div className="login">
                <React.UI.Form
                    name='form'
                    onFinish={onFinish}
                    layout='horizontal'
                    footer={
                        <React.UI.Button block type='submit' color='primary' size='large'>
                            注册
                        </React.UI.Button>
                    }
                >
                    <React.UI.Form.Header>注册</React.UI.Form.Header>
                    <React.UI.Form.Item name='mobile' label='手机号' rules={[{ required: true, message: "请输入手机号" }, { pattern: /^1[3-9]{1}\d{9}$/, message: "手机号格式不正确" }]}>
                        <React.UI.Input type="mobile" placeholder='请输入手机号' />
                    </React.UI.Form.Item>
                    <React.UI.Form.Item name='password' label='密码' rules={[{ required: true, message: "请输入密码" }, { min: 6, message: "密码长度不少于6位" }, { max: 15, message: "密码长度大于15位" }]}>
                        <React.UI.Input type="password" placeholder='请输入密码' />
                    </React.UI.Form.Item>
                </React.UI.Form>
                <div className="tips">
                    <React.Router.Link to={"/business/login"}>已经有账号?去登录</React.Router.Link>
                </div>
            </div>
        </>
    )
}



export default Register